﻿namespace WMS6.Web.Billing
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class InvoiceQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlBillingObject;
        protected DropDownList ddlBillingObjectDescr;
        protected DropDownList ddlBillingObjectID;
        protected DropDownList ddlDueFromTo;
        protected DropDownList ddlDueFromToescr;
        protected DropDownList ddlInvoiceIDDescr;
        protected DropDownList ddlStatusDescr;
        protected HtmlForm F9210;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblBillingObject;
        protected Label lblBillingObjectID;
        protected Label lblDueFromTo;
        protected Label lblInvoiceID;
        protected Label lblStatement;
        protected Label lblStatus;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtBillingObjectID;
        protected TextBox txtInvoiceID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("InvoiceList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("InvoiceList.aspx?action=" + base.UrlEncode(this.hdnActionID.Value), false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlInvoiceIDDescr, 0);
            base.InitQueryDDL(this.ddlStatusDescr, 0);
            base.InitQueryDDL(this.ddlBillingObjectID, 0);
            base.InitQueryDDL(this.ddlBillingObjectDescr, 0);
            base.InitQueryDDL(this.ddlDueFromToescr, 0);
            base.BindData2DDLBySysCode(this.ddlBillingObject, "BillingObject");
            base.BindData2DDLBySysCode(this.ddlDueFromTo, "DueFromTo");
            base.BindData2DDLBySysCode(this.MSCStatus, "InvoiceStatus");
            this.ddlStatusDescr.SelectedValue = "One Of";
            this.ddlBillingObject.Items.Insert(0, "");
            this.ddlDueFromTo.Items.Insert(0, "");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string BillingObject
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlBillingObject.Text.Trim()))
                {
                    return base.GetParamsString(this.ddlBillingObject.Text.Trim(), this.ddlBillingObjectDescr.SelectedValue);
                }
                return "";
            }
        }

        public string BillingObjectID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtBillingObjectID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtBillingObjectID.Text.Trim(), this.ddlBillingObjectID.SelectedValue);
                }
                return "";
            }
        }

        public string DueFromTo
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlDueFromTo.Text.Trim()))
                {
                    return base.GetParamsString(this.ddlDueFromTo.Text.Trim(), this.ddlDueFromToescr.SelectedValue);
                }
                return "";
            }
        }

        public string InvoiceID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtInvoiceID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtInvoiceID.Text.Trim(), this.ddlInvoiceIDDescr.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusDescr.SelectedValue);
                }
                return "";
            }
        }
    }
}

